<template>
  <div>
    <van-field v-model="username" label="用户名" />
    <van-field v-model="password" type="password" label="密码" />
    <van-button @click="denglu">登录</van-button>
  </div>
</template>

<script>
// import maxios from "@/http/axios";

export default {
  name: "login",
  data() {
    return {
      username: '',
      password: '',
    }
  },
  methods:{
    denglu(){
      this.axios.post("http://127.0.0.1:5000/login",{'username':this.username,'password':this.password})
      .then(res=>{
        console.log(res)
        localStorage.setItem('userid',res.data.uid)
        // localStorage.setItem('username',res.username)
        localStorage.setItem('token',res.data.token)
      })
    }
  }
}
</script>

<style scoped>

</style>